<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex benben-position-layout flex flex-wrap align-center platformAnnouncement_flex_0"
        :style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between flex-sub platformAnnouncement_fd0_0'>
          <view class='flex flex-wrap align-center platformAnnouncement_fd0_0_c0' @tap.stop="handleJumpDiy"
            data-type="back" data-url="1">
            <text class='fu-iconfont2  platformAnnouncement_fd0_0_c0_c0'>&#xE794;</text>
          </view>
          <view class='flex flex-wrap align-stretch justify-center'>
            <text class='platformAnnouncement_fd0_0_c1_c0'>系统消息</text>
          </view>
          <view class='flex flex-wrap align-center justify-end platformAnnouncement_fd0_0_c0'>
          </view>
        </view>

      </view>
      <view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>

      <view class="flex flex-direction align-stretch benben-flex-layout platformAnnouncement_flex_1">
        <template v-for='(item,key0) in dataMsgList'>
          <view class='flex flex-direction align-stretch platformAnnouncement_fd1_0' @tap.stop="godetail(item)"
            data-type="navigateTo" :data-url="`/pages/xiaoxi/platformDetails/platformDetails?id=${item.aid}`"
            :key='key0'>
            <view class="flex justify-between align-center">
              <text class='platformAnnouncement_fd1_0_c0'>{{item.title}}</text>
              <view class="bak-tag" v-if="item.is_read==0"></view>
            </view>

            <text class='platformAnnouncement_fd1_0_c1'>{{item.content}}</text>
            <text class='platformAnnouncement_fd1_0_c2'>{{item.create_time}}</text>
          </view>
        </template>

      </view>




    </view>
  </view>
</template>
<script>
  import {
    validate
  } from '@/common/utils/validate.js';
  import pagingList from '@/common/mixin/paging_list.js';
  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "dataMsgList": [],
        address: {
          latitude: '',
          longitude: '',
          city: ''
        }
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      this.getListFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {
      let that = this
      if (uni.getStorageSync('gugeaddress')) {
        this.address.latitude = uni.getStorageSync("gugeaddress").longitude
        this.address.longitude = uni.getStorageSync("gugeaddress").longitude
        this.address.city = uni.getStorageSync("gugeaddress").addresstxt
      } else {
        uni.getLocation({
          type: 'wgs84',
          // #ifdef APP
          geocode: true,
          // #endif
          isHighAccuracy: true,
          success: adr => {
            console.log('adradradradr', adr)
            const obj = {
              latitude: adr.latitude,
              longitude: adr.longitude,
              addresstxt: ''
            }
            uni.setStorageSync('gugeaddress', obj)
            that.address = uni.getStorageSync('gugeaddress')
            that.getdataFunc()
          },
          fail: fail => {
            that.$message.info(JSON.stringify(complete))
            console.log('complete', complete)
          }
        })
      }
    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {
      this.getListFunc()
    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      godetail(item) {
        item.is_read = 1
        if (item.partner_id == 1 && item.msg_type == 1) {
          this.$api.post(global.apiUrls.post657aa00995c85, {
            aid: item.aid
          }).then(res => {
            if (res.data.code == 1) {
              uni.navigateTo({
                url: `/pages/wode/experienceValue/experienceValue`
              })
            }
          })
        } else if (item.postoffice_id > 0 && item.msg_type == 2) {
          this.$api.post(global.apiUrls.post657aa00995c85, {
            aid: item.aid
          }).then(res => {
            if (res.data.code == 1) {
              uni.navigateTo({
                url: `/pages/zuju/organizationalDetails/organizationalDetails?aid=${item.postoffice_id}&latitude=${this.address.latitude}&longitude=${this.address.longitude}`
              })
            }
          })
          // /pages/zuju/organizationalDetails/organizationalDetails?aid=33&latitude=&longitude=

        } else {
          uni.navigateTo({
            url: `/pages/xiaoxi/platformDetails/platformDetails?id=${item.aid}`
          })
        }
      },
      //获取公告列表
      async getListFunc() {
        //请求方法
        //数据验证
        this.minixPagingListsApi = global.apiUrls.post657a9fb1a57bc;
        this.pageingListApiMethod = 'post';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {}
        this.listData = [];
        this.dataMsgList = this.listData;
        this.pagingListToggle();
      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .bak-tag {
    width: 10rpx;
    height: 10rpx;
    background-color: red;
    border-radius: 50%;
  }

  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: rgba(248, 248, 248, 1);
    background-size: 100% auto;
  }

  .platformAnnouncement_flex_0 {
    border-bottom: 1px solid #eee;
    background: #fff;
    width: 750rpx;
    height: 88rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: 100% auto !important;
  }

  .platformAnnouncement_fd0_0_c1_c0 {
    font-size: 36rpx;
    font-weight: 700;
    color: #333333;
    line-height: 50rpx;
  }

  .platformAnnouncement_fd0_0_c0_c0 {
    font-size: 36rpx;
    color: #333;
  }

  .platformAnnouncement_fd0_0_c0 {
    width: 120rpx;
  }

  .platformAnnouncement_fd0_0 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .platformAnnouncement_flex_1 {
    padding: 25rpx 32rpx 0rpx 32rpx;
  }

  .platformAnnouncement_fd1_0_c2 {
    border-top: 1px solid #eee;
    line-height: 46rpx;
    margin: 24rpx 0rpx 0rpx 0rpx;
    font-size: 24rpx;
    font-weight: 400;
    color: rgba(153, 153, 153, 1);
    padding: 24rpx 0rpx 0rpx 0rpx;
  }

  .platformAnnouncement_fd1_0_c1 {
    margin: 24rpx 0rpx 0rpx 0rpx;
    font-size: 28rpx;
    font-weight: 400;
    color: rgba(102, 102, 102, 1);
    line-height: 42rpx;
    -webkit-line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .platformAnnouncement_fd1_0_c0 {
    font-size: 32rpx;
    font-weight: 700;
    color: #333333;
    line-height: 36rpx;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .platformAnnouncement_fd1_0 {
    background: #fff;
    padding: 24rpx;
    background-size: 100% auto !important;
    border-radius: 16rpx;
    margin: 0rpx 0rpx 24rpx 0rpx;
  }
</style>
